{% extends 'base.html' %}

{% block title %}详情{% endblock %}

{% block head %}
    <link rel="stylesheet" href="{{ url_for('static', filename='css/detail.css') }}">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/answer.css') }}">
{% endblock %}

{% block main %}
    <h3 class="page-title">{{ question.title }}</h3>
    <div class="question-info">
        <span class="author">作者：{{ question.author.username }}</span>
        <span class="time">时间：{{ question.create_time }}</span>
    </div>
    <hr>
    <p>
        {{ question.content }}
    </p>
    <hr>
    <h4>评论：(0)</h4>
    <form action="{{ url_for('add_answer') }}" method="post">
        <div class="form-group">
            <input type="text" class="form-control" placeholder="请填写评论" name="answer_content">
            <input type="hidden" name="question_id" value="{{ question.id }}">
        </div>
        <div class="form-group" style="text-align: right;">
            <button class="btn btn-primary" type="submit">立即提交</button>
        </div>
    </form>
    <hr>
    <ul>
        {% for answer in question.answers %}
            <li>
                <div class="answer-container">
                    <img src="{{ url_for('static', filename='images/avatar.jpeg') }}" alt="" class="avatar">
                    <span class="author">{{ answer.user.username }}</span>
                    <span class="create_time">{{ answer.create_time }}</span>
                    <p class="answer-content">{{ answer.content }}</p>
                </div>
            </li>
        {% endfor %}

    </ul>
{% endblock %}